package main

import (
    "fmt"
    "strings"
    "strconv"
)
func test1() {
	fmt.Println("Split 函数的用法")
    fmt.Printf("%q\n", strings.Split("Linux,Python,Golang,Java", ","))
    fmt.Printf("%q\n", strings.Split("a mountain a temple", "a "))
    fmt.Printf("%q\n", strings.Split(" abc ", ""))
    fmt.Printf("%q\n", strings.Split("", "oldboy"))
    fmt.Println("Fields 函数的用法")
    fmt.Printf("Fields are: %q\n", strings.Fields(" Linux Python Golang  Java "))
}

func test2(v string) (bool,uint32) {
	a := strings.Split(v, ".")
	if(len(a) != 2) {
		return false, 0
	}
	dec1, err := strconv.Atoi(a[0])
	if err != nil {
		return false, 0
	}
	dec2, err := strconv.Atoi(a[1])
	if err != nil && dec2 < 100{
		return false, 0
	}
	var n uint32 = 100 * uint32(dec1) + uint32(dec2)
	return true, n
}


func main() {
 	//test1()
 	b, n := test2("2.13") 
	if b {
		fmt.Println(n)
	}
}

